<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:m="http://www.ol4jsf.org"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:o="http://openfaces.org/"
	template="/WEB-INF/esquema/toolbarTemplate.xhtml">


	<ui:define name="customContent">
	</ui:define>
	
	<ui:define name="mainControls">
		<h:form>
			<h:outputText value="#{messages['txt.quick_search']}   " style="font-weight:bold;" />
			<h:selectOneMenu value="#{transactionQueryHelper.searchSelector}">
				<f:selectItem itemValue="0" itemLabel="#{messages['txt.presentation_no']}"/>
				<f:selectItem itemValue="1" itemLabel="#{messages['txt.current_state']}"/>
				<f:selectItem itemValue="2" itemLabel="#{messages['txt.type']}"/>
			</h:selectOneMenu>
			<h:outputText value="  " />
			<h:inputText value="#{transactionQueryHelper.searchText}" />
			<h:outputText value="  " />
			<h:commandButton value="#{messages['txt.search']}" action="#{transactionQueryHelper.doNewSearch}" reRender="searchResult" />
		</h:form>
	</ui:define>

	<ui:define name="extraControls">
		<o:commandButton value="#{messages['txt.new_search']}" onclick="back2analysis();" />
		
		<o:commandButton rendered="#{transactionQueryHelper.approvedLocally}"
			type="button"
			value="#{messages['txt.cadastral_record']}"
			onclick="#{rich:element('cadastralRecord')}.click();">
		</o:commandButton>
	</ui:define>

	<ui:define name="body">
		<a4j:loadScript src="#{generalHelper.openLayersJS}" />
		<div align="center">
			<br />
			<h3>#{messages['query.transaction_title']}</h3>
			<rich:separator lineType="solid"/>
			<br />
			<h:panelGroup id="searchResult">
				<h:panelGroup rendered="#{transactionQueryHelper.selected != null}">
					<ui:include src="/WEB-INF/includes/transaction/transactionMainInfo.xhtml">
						<ui:param name="transaction" value="#{transactionQueryHelper.selected}" />
					</ui:include>
					<br />
					<h:form>
						<rich:tabPanel id="queryTabPanel" switchType="client">
							<rich:tab label="Seguimiento" >
								<ui:include src="/WEB-INF/includes/transaction/transactionTrack.xhtml">
									<ui:param name="transaction" value="#{transactionQueryHelper.selected}" />
								</ui:include>
							</rich:tab>
							<rich:tab label="Zonas espaciales involucradas" >
								<ui:include src="/WEB-INF/includes/transaction/transactionSpatialZones.xhtml">
									<ui:param name="transaction" value="#{transactionQueryHelper.selected}" />
								</ui:include>
							</rich:tab>
							<rich:tab label="Estado antes y despues de la transaccion" >
								<ui:include src="/WEB-INF/includes/transaction/transactionStates.xhtml">
									<ui:param name="transaction" value="#{transactionQueryHelper.selected}" />
								</ui:include>
							</rich:tab>
						</rich:tabPanel>
					</h:form>
				</h:panelGroup>
				
				<h:panelGroup rendered="#{transactionQueryHelper.selected == null}">
					<br />
					#{messages['query.transaction.no_result_line1']}
					<br />
					#{messages['query.transaction.no_result_line2']}
				</h:panelGroup>
			</h:panelGroup>

			<br />
			<br />

		</div>
		<br />
		
		<h:form rendered="#{transactionQueryHelper.approvedLocally}">
			<h:commandLink
				id="cadastralRecord" value="Certifique"
				action="/queries/reports/cadastralRecord.xhtml"
				target="_blank" style="visibility:hidden;">
				<f:setPropertyActionListener target="#{cadastralRecordHelper.transaction}" value="#{transactionQueryHelper.selected}"/>
			</h:commandLink>
		</h:form>
	</ui:define>
</ui:composition>
